<template>
<div class="layerRtb layerRtb-threecolumn">
    <three-title :title="{name:'材料'}"></three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "137">
        <div class="analyItem">
            <p class="analyItemTit tx-center">材料</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="cLightGray pr8">材料商</span>
                    <span>{{storeData.storeNum}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">项目数量</span>
                    <span>{{storeData.proNum}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">配比</span>
                    <span>{{(storeData.matProportioning * 100).toFixed(2)}}%</span>
                </p>
            </div>
        </div>
        <div class="analyItem">
            <p class="analyItemTit tx-center">厂家</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="cLightGray pr8">厂家</span>
                    <span>{{factoryData.storeNum}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">项目数量</span>
                    <span>{{factoryData.proNum}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">配比</span>
                    <span>{{(factoryData.matProportioning * 100).toFixed(2)}}%</span>
                </p>
            </div>
        </div>
        <div class="analyItem">
            <p class="analyItemTit tx-center">厂店</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="cLightGray pr8">厂店</span>
                    <span>{{factoryStoreData.storeNum}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">项目数量</span>
                    <span>{{factoryStoreData.proNum}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">配比</span>
                    <span>{{(factoryStoreData.matProportioning * 100).toFixed(2)}}%</span>
                </p>
            </div>
        </div>
    </div>
    <div class="layerRtb-footer">
        <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="pr8 cLightGray">材料配比</span>
                    <span>{{(storeData.matProportioning * 100).toFixed(2)}}%</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">厂家配比</span>
                    <span>{{(factoryData.matProportioning * 100).toFixed(2)}}%</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">厂店配比</span>
                    <span>{{(factoryStoreData.matProportioning * 100).toFixed(2)}}%</span>
                </p>
            </div>
        </div>

    </div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getMaterialProportioningByCompany } from '../../Resources/Api'
export default {
    data () {
        return {
            parmasExample: {
                name: '',
                age: ''
            },
            storeData: {}, // 材料
            factoryData: {}, // 厂家
            factoryStoreData: {} // 厂店

        }
    },
    created () {
        this.getMaterialProportioningByCompany() // 材料
    },
    computed: {
        ...mapGetters(['userInfo', 'leftInfo'])
    },
    methods: {
        getMaterialProportioningByCompany () {
            getMaterialProportioningByCompany({
                companyID: this.leftInfo.u_diqu

            }).then(res => {
                if (res.data.statusCode === 0) {
                    this.storeData = res.data.body.storeData
                    this.factoryData = res.data.body.factoryData
                    this.factoryStoreData = res.data.body.factoryStoreData
                }
            }).catch(err => {
                console.log(err)
            })
        }
    }
}
</script>

